//基本的数字类型,会自动进行类型推断
const numberArray1 = [1, 2, 3];
const numberArray2: number[] = [1, 2, 3];
const stringArray1 = ["a", "b", "c"];
const undefinedArray: undefined[] = [undefined, undefined];
//有数字,有字符串的数组定义
const arr: (number | string)[] = [1, "string"];
//有对象的数组定义
const xiaoJieJie6: { name: string; age: number }[] = [
  { name: "刘英", age: 18 },
  { name: "x谢大脚", age: 29 },
];
//type alias 类型别名,可以用type,interface,不可以使用class作为类型别名
type Lady = { name: string; age: number };
interface Woman {
  name: string;
  age: number;
}

const xiaoJieJie61: Lady[] = [
  { name: "刘英", age: 18 },
  { name: "x谢大脚", age: 29 },
];
const xiaoJieJie62: Woman[] = [
  { name: "刘英", age: 18 },
  { name: "x谢大脚", age: 29 },
];
console.log(xiaoJieJie61);
console.log(xiaoJieJie62);

//会报错
// class Madame {
//   name: string;
//   age: number;
// }
// const xiaoJieJie63: Madame[] = [
//   { name: "刘英", age: 18 },
//   { name: "x谢大脚", age: 29 },
// ];
// console.log(xiaoJieJie63);
